{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="ibox float-e-margins">
        <div class="ibox-content">
            <div class="row">
                <!--搜索框开始-->
                <div class="col-sm-12">
                    <div class="layui-form layui-form-item">

                        <div class="layui-col-md6 layui-input-inline" style="margin-top: 5px">
                            <input type="text" id="school" class="layui-input search" name="school" value="" placeholder="学校名字|学校编码"/>
                        </div>
                        <div class="layui-col-md6 layui-input-inline" style="margin-top: 5px">
                            <input type="text" class="layui-input search" name="year" value="" placeholder="年份"/>
                        </div>
                        <div class="layui-input-inline layui-form" style="margin-top: 5px">
                            <select name="status" lay-search="" class="layui-input">
                                <option value="">不限状态</option>
                                <option value="1">正常</option>
                                <option value="2">冻结</option>
                            </select>
                        </div>
                        <div class="layui-input-inline" style="margin-top: 5px">
                            <button class="layui-btn" lay-submit="" lay-filter="LAY-search">立即搜索</button>
                            <button  class="layui-btn layui-btn-normal" id="empty"  lay-submit="" lay-filter="LAY-search">重置</button>
                        </div>
                    </div>
                </div>
                <!--搜索框结束-->
                <!--操作框开始-->
                <div class="col-sm-12">
                    <div class="input-group" >
                        <button class="btn btn-primary" type="button" onclick="wk.layer_show('新建', '{:url('activeAdd')}');">
                            <i class="fa fa-plus"></i> 新建
                        </button>
                    </div>
                </div>
                <!--操作框结束-->
            </div>
            <div class="example-wrap">
                <div class="example">
                    <table class="layui-hide" id="test" lay-filter="demo"></table>
                    <script type="text/html" id="staBar2">
                        <input type="checkbox" value="{{d.ts_id}}"  lay-skin="switch"  lay-text="开启|关闭" lay-filter="OnOff2" {{ d.ts_status == 1 ? 'checked' : '' }}  >
                    </script>
                    <!--图片模板-->


                    <!--操作模板-->
                    <script type="text/html" id="opeBar">
                        {{# if(d.ts_time >= '2022-03-15'){ }}
                        <a href="javascript:;" onclick="wk.layer_show('编辑','{:url('activeEdit')}?ts_id={{d.ts_id}}')" class="btn btn-primary btn-xs m-r-xs" title="编辑"><i class="fa fa-pencil">编辑</i></a>
                        <!--<a href="javascript:;" onclick="wk.href('{:url('setGoods')}?ts_id={{d.ts_id}}&erp={{d.ts_school_erp}}&year={{d.ts_year}}')" class="btn btn-primary btn-xs m-r-xs" title="指定校服"><i class="fa fa-pencil">指定校服</i></a>-->
                        <a href="javascript:;" onclick="wk.layer_show('指定校服（夏、秋、礼、冬、西）', '{:url('setGoods')}?ts_id={{d.ts_id}}&erp={{d.ts_school_erp}}&year={{d.ts_year}}')" class="btn btn-warning btn-xs m-r-xs" title="指定校服"><i class="fa fa-edit">指定校服</i></a>
                        {{# } }}
                    </script>
                </div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}
<script>
    //layui渲染数据表格
    layui.use('table', function () {
        var table = layui.table
                , form = layui.form;
        table.render({
            elem: '#test'
            , url: '{:url("Tong/index")}'
            ,response: {
                statusCode: 220 //成功的状态码，默认：0
            }
            , page: true
            , size: 'lg' //sm小尺寸的表格 lg大尺寸
            , cellMinWidth: 150
            , limits: [5, 10, 15, 20, 25, 30]
            , limit: "{:config('pages')}"
            , loading: true
            , id: 'testReload'
            , cols: [[
//                {type: 'checkbox', fixed: 'left',}
                  {type:'numbers', width: 70, title: '序号'}
                , {field: 'school_name', width: '', title: '学校名称', align: 'center'}
                , {field: 'ts_money', width: '', title: '统购价格', align: 'center'}
                , {field: 'ts_boy_money', width: '', title: '男款价格', align: 'center'}
                , {field: 'ts_girl_money', width: '', title: '女款价格', align: 'center'}
                , {field: 'ts_post', width: '', title: '邮费', align: 'center'}
                , {field: 'ts_year', width: '', title: '年份', align: 'center'}
                , {field: 'ts_grade', width: '', title: '年级', align: 'center'}
                , {field: 'ts_begin', width: '', title: '开始日期', align: 'center'}
                , {field: 'ts_end', width: '', title: '截止日期', align: 'center'}
                , {field: 'ts_student', width: '', title: '学生名单', align: 'center'}
                , {field: 'ts_time', width: '', title: '创建时间', align: 'center'}
                , {field: 'ts_status',fixed: 'right', width: '100', title: '状态', align: 'center', templet: '#staBar2'}
                , {fixed: 'right', width: 200, title: '操作', align: 'center', toolbar: '#opeBar'}
            ]]
            ,done: function (res, curr, count) {
                $('.img-circle').viewer({
                    url: 'data-original',
                });
            }
        });
        form.on('switch(OnOff2)', function (obj) {
            var num = '';
            obj.elem.checked == true? num = 1: num = 2;
            //用户状态
            wk.status(this.value,num, '{:url("changeStatus")}',obj);
        });
    });
</script>
</body>
</html>